package com.ly.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author 李岩
 * @date 2021/12/7-19:07
 * @describe
 */
public class NewFileNameUtil {

    public static String getNewFileName(String oldFileName){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssms");
        if (oldFileName==null || "".equals(oldFileName)||oldFileName.lastIndexOf(".")+1==-1){
            return oldFileName;
        }
        String suffix = oldFileName.substring(oldFileName.lastIndexOf(".") + 1);
        Date date = new Date();
        String format = sdf.format(date);
        return format+"."+suffix;
    }
}
